﻿namespace MrdocUtils.Model
{
    public class ServiceAPIResult
    {
        /// <summary>
        ///
        /// </summary>
        public bool status { get; set; }
        /// <summary>
        ///
        /// </summary>
        public object data { get; set; }
    }
    public class ProjectsModel
    {
        /// <summary>
        /// 文集id
        /// </summary>
        public int id { get; set; }
        /// <summary>
        /// 文集名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string icon { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int type { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int total { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_time { get; set; }
    }

    public class DocsModel
    {
        /// <summary>
        ///
        /// </summary>
        public int id { get; set; }
        /// <summary>
        /// 文档名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int parent_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int top_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int status { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string modify_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_user { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int editor_mode { get; set; }
    }

    public class SelfDocModel
    {
        /// <summary>
        ///
        /// </summary>
        public int id { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string name { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string summary { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int parent_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int top_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string project_name { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int project_role { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string project_icon { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int editor_mode { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int status { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string modify_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_user { get; set; }
    }

    public class DocContentModel
    {
        /// <summary>
        ///
        /// </summary>
        public int id { get; set; }
        /// <summary>
        /// 从导入的CAD中获得所有类型的线
        /// </summary>
        public string name { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string content { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string md_content { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int parent_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int top_doc { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int status { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int editor_mode { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string modify_time { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string create_user { get; set; }
    }

    /// <summary>
    /// 创建文集
    /// </summary>
    public class CreateProjectModel : IUrlPara
    {
        public string name { get; set; }
        public string desc { get; set; }

        /// <summary>
        /// 文集的访问权限类型(默认1),如:0公开/1私密/2指定用户可见/3访问码
        /// </summary>
        public int role { get; set; } = 1;

        public string ConvertToUrlPara()
        {
            return $"&name={name}&desc={desc}&role={role}";
        }
    }

    /// <summary>
    /// 创建文档
    /// </summary>
    public class CreateDocModel : IUrlPara
    {
        /// <summary>
        ///【必填】文集ID
        /// </summary>
        public int pid { set; get; }
        /// <summary>
        ///【必填】文档的标题
        /// </summary>
        public string title { set; get; }
        /// <summary>
        /// 【必填文档的内容
        /// </summary>
        public string doc { set; get; }
        /// <summary>
        /// 【可选】文档的上级文档ID，默认为0
        /// </summary>
        public int parent_doc { set; get; } = 0;
        /// <summary>
        /// 【可选】文档的编辑模式，默认为1
        /// </summary>
        public int editor_mode { set; get; } = 1;
        public string ConvertToUrlPara()
        {
            return $"&pid={pid}&title={title}&doc={doc}&parent_doc={parent_doc}&editor_mode={editor_mode}";
        }
    }

    public class UploadImgResult
    {
        /// <summary>
        /// 是否上传成功，1为成功
        /// </summary>
        public int success { get; set; }
        /// <summary>
        /// 图片上传后的url
        /// </summary>
        public string url { get; set; }
        /// <summary>
        /// 上传状态消息
        /// </summary>
        public string message { get; set; }
    }

    public class ModifyDocModel : IUrlPara
    {
        /// <summary>
        ///【必填】文集ID
        /// </summary>
        public int pid { set; get; }

        /// <summary>
        /// 文档ID
        /// </summary>
        public string did { set; get; }

        /// <summary>
        ///【必填】文档的标题
        /// </summary>
        public string title { set; get; }
        /// <summary>
        /// 【必填文档的内容
        /// </summary>
        public string doc { set; get; }

        public string ConvertToUrlPara()
        {
            return $"&pid={pid}&did={did}&title={title}&doc={doc}";
        }
    }
    public interface IUrlPara
    {
        public string ConvertToUrlPara();
    }
}